<?php
/*
<Controller Information> 
Author: Naseer Ahmad
Date: 12-10-2011
Last Updated on: 
*/

class adminLoginController extends appController
{
	function index()
	{
		
		$this -> render('Admin Login');
	}
	
	function verify()
	{
		//print_r($this->data);
		//exit;
		
		if($this -> adminLogin -> verifyLogin($this->data['_username'], 
							$this->data['_password']))
		{
			$fv=array("userLastLogin"	=> "NOW()");
			$where=array("userID"	=> $_COOKIE['adminid_gosell']);
			$this -> adminLogin -> _updateTable("usersInfo", $fv, $where);
			$this -> redirect('adminHome');
		}
		else
		{
			$this -> set('bad', 'Your username/password is not valid');
					
			$this -> render('Admin Login');
		}
		

		//$this -> render();
	}
	
	function logout()
	{
		setcookie("adminid_gosell", "", time()-3600,"/");
		setcookie("adminname_gosell", "", time()-3600,"/");
		
		$this -> redirect('adminLogin');
	}
	
	function bad()
	{
		
		$this -> set('bad', 'Login First');
		$this -> render('Admin Login');
	}
}
?>